<div class="layui-tab layui-tab-brief">
    <ul class="layui-tab-title" style="width: 100%;float:left">
        <li class="#(tab=='EditSysRole'?'layui-this':'')" lay-event="EditSysRole"><i class="layui-icon layui-icon-tabs"></i> #(form.actions=='EDIT'?'编辑':'创建新的')角色</li>
        <li class="#(tab=='SetRoleMenu'?'layui-this':'')" lay-event="SetRoleMenu"><i class="layui-icon layui-icon-list"></i> 角色菜单</li>
        <li class="#(tab=='SetRoleActivity'?'layui-this':'')" lay-event="SetRoleActivity"><i class="layui-icon layui-icon-set-sm"></i> 角色功能</li>
        <li class="#(tab=='SetRoleUser'?'layui-this':'')" lay-event="SetRoleUser"><i class="layui-icon layui-icon-username"></i> 角色人员</li>
    </ul>
</div>

<script>
    layui.use(['form', 'myTool', 'myNumber', 'util'], function () {
        var form = layui.form, $ = layui.$;

        layui.util.event("lay-event", {
            EditSysRole: function () {
                if ($("#actions").val() === 'ADD') {
                    layer.msg("请先创建角色");
                    return;
                }
                location.href = "EditSysRole?id=" + $("#id").val();
            },
            SetRoleMenu: function () {
                if ($("#actions").val() === 'ADD') {
                    layer.msg("请先创建角色");
                    return;
                }
                location.href = "SetRoleMenu?id=" + $("#id").val();
            },
            SetRoleActivity: function () {
                if ($("#actions").val() === 'ADD') {
                    layer.msg("请先创建角色");
                    return;
                }
                location.href = "SetRoleActivity?id=" + $("#id").val();
            },

            SetRoleUser: function () {
                if ($("#actions").val() === 'ADD') {
                    layer.msg("请先创建角色");
                    return;
                }
                location.href = "SetRoleUser?id=" + $("#id").val();
            },

        });

        form.on('submit(Submit1)', function (data) {
            layui.myTool.postJson('ModifySysRoleApi', data.field, function (results) {
                top.layer.closeAll();
                return false;
            });
            return false;
        });
    });
</script>